****************************************************************************************
** TABLE A5
****************************************************************************************
****************************************************************************************
use "${path}data_table.dta", clear

label var npubs "\emph{Pubs}"
label var citations_new "\emph{Cites}"
label var np_if_3y "\emph{AIF}"
label var top95_ay   "\emph{Top5}"
label var top90_ay   "\emph{Top10}"

label var nb_collab_same_labex "\emph{Links}"
label var citations_new "\emph{Cites}"
gen age_2010 = age if year ==2010
bys id_20:  egen age_in_2010=max( age_2010)
drop age_2010
gen discipline=0
replace discipline=1 if biologie_fondamentale ==1
replace discipline=2 if recherche_medicale ==1
replace discipline=3 if biologie_appliquee_ecologie ==1
replace discipline=4 if chimie ==1
replace discipline=5 if physique ==1
replace discipline=6 if sciences_univers ==1
replace discipline=7 if sciences_ingenieur ==1
replace discipline=8 if mathematiques ==1
replace discipline=9 if SS ==1
replace discipline=10 if SH ==1
local regnom    "prod_rest_more_outcomes2"
eststo clear 
qui eststo:  reghdfe npubs treat2  if  id_year==1  & criterion_grade==1  ,  a( i.discipline#i.year age_in_2010#i.year female_new#i.year  year id_2019) cluster(labexid)  
qui :  estadd ysumm 
qui :  estadd scalar clusters = e(N_clust)
qui eststo:  reghdfe citations_new treat2  if  id_year==1  & criterion_grade==1  ,  a( i.discipline#i.year age_in_2010#i.year female_new#i.year  year id_2019) cluster(labexid)  
qui :  estadd ysumm   
qui :  estadd scalar clusters = e(N_clust)
qui eststo:  reghdfe top90_ay treat2  if  id_year==1  & criterion_grade==1  ,  a( i.discipline#i.year age_in_2010#i.year female_new#i.year  year id_2019) cluster(labexid)  
qui :  estadd ysumm  
qui :  estadd scalar clusters = e(N_clust)
qui eststo:  reghdfe top95_ay treat2  if  id_year==1  & criterion_grade==1  ,  a( i.discipline#i.year age_in_2010#i.year female_new#i.year  year id_2019) cluster(labexid)  
qui :  estadd ysumm  
qui :  estadd scalar clusters = e(N_clust)
esttab,  compress ar2 starlevels(* 0.1 ** 0.05 *** 0.01)  b(%4.3f) se(%4.3f) label   keep(treat2) stats(N clusters   ymean r2_a, fmt(%9.0g %9.2g %9.2g  ) labels("Observations" "Number of Clusters" "Mean dep variable" "Adj. R-Square" )) nolegend nose nonotes
esttab using  `regnom',   b(%4.3f) se(%4.3f) ar2 starlevels({$^{*}$} 0.1 {$^{**}$} 0.05 {$^{***}$} 0.01)  tex  label replace keep(treat2) stats(N clusters ymean r2_a, fmt(%9.0g %9.2g %9.2g  ) labels("Observations" "Number of Clusters" "Mean dep variable" "Adj. R-Square" )) nolegend nonotes
eststo clear 

